package com.idemon.springbootmongodb;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.List;

@SpringBootApplication
public class SpringBootMongodbApplication implements CommandLineRunner {

	public static void main(String[] args) {
		SpringApplication.run(SpringBootMongodbApplication.class, args);
	}

	@Autowired
	private UserinfoDAO userinfoDAO;
	@Override
	public void run(String... args) throws Exception {
		List<Userinfo> list = userinfoDAO.findAll();
		for (int i = 0; i < list.size(); i++) {
			Userinfo userinfo =  list.get(i);
			System.out.println(userinfo);
		}
	}
}
